Skip to content

Fix SortedSet set-operation checks throwing for views - #138354

Open
kmz wants to merge 3 commits into
dotnet:mainfrom
kmz:fix/sortedset-view-setoperations
Open

kmz wants to merge 3 commits into
dotnet:mainfrom
kmz:fix/sortedset-view-setoperations

Conversation

@kmz

@kmz kmz commented Nov 26, 2026 •

Copy link
Copy Markdown

The following methods prune one of the sets with GetViewBetween(other.Min, other.Max):

  • IsSubsetOf
  • IsProperSubsetOf
  • IsSupersetOf
  • IsProperSupersetOf

When the set being pruned is itself a view and those bounds fall outside it, GetViewBetween throws ArgumentOutOfRangeException instead of the check returning false.

Skip the pruning when the set is a view. It is only an optimization, and the containment loop gives the same result without it.

kmz added 2 commits November 24, 2026 21:37
IsSupersetOf/IsProperSupersetOf prune this set with GetViewBetween(other.Min, other.Max),
and IsSubsetOf/IsProperSubsetOf prune the argument the same way. When the set being pruned
is itself a TreeSubSet view and the bounds fall outside the view, GetViewBetween throws
ArgumentOutOfRangeException instead of the checks returning false.

Skip the pruning when the set is a view; the containment loops are correct without it.
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 26, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

@kmz

kmz commented Nov 26, 2026

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Collections community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant